package view
{
	import flash.display.MovieClip;
	import flash.events.TimerEvent;
	import flash.events.MouseEvent;
	import flash.utils.Timer;
	
	public class Kasse extends MovieClip
	{		
		private var timer:Timer;
		
		public function Kasse()
		{
			super();
			this.stop();				
		}
		
		private function openAndCloseCashPoint(e:TimerEvent) {			
			this.nextFrame();
			if (this.currentFrame == this.framesLoaded) {
				this.gotoAndStop(1);
				this.timer.stop();
			}
		}
		
		public function triggerOpenAndClose(e:MouseEvent) {			
			this.timer = new Timer(Config.CashPoinOpenAndCloseSpeedMs);
			this.timer.addEventListener(
				TimerEvent.TIMER,
				this.openAndCloseCashPoint
			);			
			this.timer.start();
		}
	}
}